Skip to content

Conversation

@uditagarwal97
Copy link
Contributor

@uditagarwal97 uditagarwal97 commented Nov 20, 2025

Deadlock can happen if L0 calls exit() while we are in the middle of enqueuing a command.

@uditagarwal97 uditagarwal97 self-assigned this Nov 20, 2025
@uditagarwal97 uditagarwal97 marked this pull request as ready for review November 20, 2025 18:48
@uditagarwal97 uditagarwal97 requested a review from a team as a code owner November 20, 2025 18:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses a deadlock issue that can occur during application shutdown when Level Zero (L0) calls exit() while command enqueue operations are in progress. The fix introduces checks using GlobalHandler::instance().isOkToDefer() to avoid strict lock acquisition during shutdown scenarios.

  • Adds shutdown-aware checks before attempting host memory updates
  • Modifies removeMemoryObject call to accept a parameter indicating whether strict locking is required
  • Updates assertion logic to account for potential failures during shutdown


void SYCLMemObjT::updateHostMemory() {
if ((MUploadDataFunctor != nullptr) && MNeedWriteBack)
// Don't try updating host memory when stutting down.
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'stutting' to 'shutting'.

Suggested change
// Don't try updating host memory when stutting down.
// Don't try updating host memory when shutting down.

Copilot uses AI. Check for mistakes.
std::ignore = Result; // for no assert build

// removeMemoryObject might fail during shutdown because of not being
// able to hold write lock. This can happen if shutdown happen due to
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected grammar: 'shutdown happen' should be 'shutdown happens'.

Suggested change
// able to hold write lock. This can happen if shutdown happen due to
// able to hold write lock. This can happen if shutdown happens due to

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants